#include<iostream>
#include<map>
using namespace std;
map<int, int>mp;
typedef long long LL;
const int N = 1e5 + 10;
int n;
int a[N];
int main()
{
	int t;
	cin >> t;
	while (t--) {
		mp.clear();
		bool flag = 0;
		LL sum = 0;
		LL sum1 = 0;
		cin >> n;
		for (int i = 1; i <= n; i++) {
			cin >> a[i];
			sum += a[i];
			mp[a[i]]++;
			if (mp[a[i]] >= 2)flag = 1;
			if (a[i] != 1)sum1 += a[i];
		}
		if (n == 1) {
			cout << "NO" << endl;
			continue;
		}
		if (!flag)cout << "YES" << endl;
		else {
			LL ans = 0;
			//cout << "x==" << 11 << endl;
			for (int i = 1; i <= n; i++) {
				ans += i;
			}
			if (sum >= ans) {
				cout << "YES" << endl;
				continue;
			}
			int x = mp[1];
			//cout << "x==" << x << endl;
			if (x > n / 2) {
				int d = n - x;
				sum -= d;
				if (sum >= 2 * x) {
					cout << "YES" << endl;
				}
				else cout << "NO" << endl;
			}
			else cout << "YES" << endl;
		}
	}
	return 0;
}